#include <REGX52.H>
#include "Timer0.h"
#include "key.h"
#include <INTRINS.H>

unsigned char keynum,LEDMODE;



void main()
{
	P2=0xfe;
	Timer0_init();
	while(1)
    {
        keynum=key();
		if(keynum)
		{
			if(keynum==1)
			{
				LEDMODE++;
				if(LEDMODE>=2)
				{
					LEDMODE=0;
				}
			}
			
		}
    }
}



void Timer0_Routine()  interrupt 1
{
	static unsigned int T0Count;
	TL0 = 0xCD;		//??????
	TH0 = 0xD4;		//??????
	T0Count++;
	if(T0Count>=500)
	{
		T0Count=0;
		if(LEDMODE==0)
		{
			P2=_crol_(P2,1);
		}
		if(LEDMODE==1)
		{
			P2=_cror_(P2,1);
		}
	}


}